<!DOCTYPE html>
<html lang="en">

	<include file="Public:header" />
	<include file="Public:page_css" />
	<script>
$(function(){
	$('#add').ajaxForm({
		beforeSubmit: checkForm, // 此方法主要是提交前执行的方法，根据需要设置
		success: complete, // 这是提交后的方法
		dataType: 'json'
	});

	function checkForm(){
		if( '' == $.trim($('#username').val())){
			layer.alert('用户名不能为空', {icon: 5}, function(index){
 			layer.close(index);
			$('#username').focus();
			});
			return false;
		}

 }
	function complete(data){
		if(data.status==1){
			layer.msg(data.info, {icon: 6,time:1000}, function(index){
 			layer.close(index);
			window.location.href=data.url;
			});
		}else{
			layer.msg(data.info, {icon: 5,time:1000}, function(index){
 			layer.close(index);
			});
			return false;
		}
	}

});
</script>
	<body class="fixed-sidebar full-height-layout gray-bg" style="overflow:hidden">
		<include file="Public:nav" />
		<div class="row wrapper border-bottom white-bg page-heading">
            <div class="col-lg-12">
                <h2>添加会员</h2>
                <ol class="breadcrumb">
                    <li>
                        <a href="{:U('Index/index')}"><i class="fa fa-home"></i> 主页</a>
                    </li>
                    <li>
                        <a>会员管理</a>
                    </li>
                    <li>
                        <strong>添加会员</strong>
                    </li>
                </ol>
            </div>
        </div>
		<div class="row">
			<div class="col-sm-12">
				<div class="ibox float-e-margins">
					<div class="ibox-title">
						<h5>添加会员</h5>
						<div class="ibox-tools">
							<a class="collapse-link">
								<i class="fa fa-chevron-up"></i>
							</a>
						</div>
					</div>
					<div class="ibox-content">
						<form class="form-horizontal" name="add" id="add" method="post" action="__URL__/add">

							<!-- <div class="form-group">
				                <label class="col-sm-2 control-label">所属角色</label>
				                <div class="col-sm-5">
                                    <select id="group_id" name="group_id" class="form-control m-b chosen-select">

			                            <option value="">请选择所属角色</option>
                                        <foreach name="auth_group" item="v">
                                        	<option value="{$v.id}">{$v.title}</option>
                                        </foreach>
			                    	</select>
				                </div>
				            </div> -->
				            <div class="hr-line-dashed"></div>
				            <div class="form-group">
								<label class="col-sm-2 control-label"> 用户名</label>
								<div class="col-sm-5">
									<input type="text" name="username" id="username" placeholder="请输入用户名" class="form-control" />
								</div>
							</div>
                            <div class="hr-line-dashed"></div>
							<div class="form-group">
								<label class="col-sm-2 control-label">性别
								</label>
								<div class="col-sm-6">
									<div class="radio i-checks">
										<label><input type="radio" value="1" name="sex" > <i></i> 男</label>
										<label><input type="radio" value="2" name="sex" > <i></i> 女</label>
										<label><input type="radio" value="3" name="sex" checked > <i></i> 保密</label>
									</div>
								</div>
							</div>
							<div class="hr-line-dashed"></div>
							<div class="form-group">
                                <label class="col-sm-2 control-label">出生日期</label>
                                <div class="col-sm-3">
                                    <input class="form-control layer-date" name="birthdate" id="birthdate" placeholder="请选择出生日期" onclick="laydate()">
                                    <label class="laydate-icon"></label>
                                </div>
                            </div>
							<div class="hr-line-dashed"></div>
							<div class="form-group">
								<label class="col-sm-2 control-label">头像 </label>
								<div class="col-sm-6">
									<div style="width: 200px; height: 90px; float: left;">
										<input type="hidden" name="headpic" value="" id="data_photo" />
										<input id="photo_file" name="photo_file" type="file" multiple="true" value="" />
									</div>
									<div style="width: 200px; height: 90px; float: left;">
										<img id="upload_img" class="img-circle" src="" onerror="this.src='__PUBLIC__/Admin/img/touxiang_default.gif'" style="width: 80px;height: 80px" />
									</div>
								</div>
							</div>
							<div class="hr-line-dashed"></div>
							<div class="form-group">
								<label class="col-sm-2 control-label"> 邮箱</label>
								<div class="col-sm-5">
									<input type="text" name="email" id="email" placeholder="用于密码找回，请认真填写" class="form-control" />
								</div>
							</div>
                            <div class="hr-line-dashed"></div>

							<div class="form-group">
								<label class="col-sm-2 control-label"> 电话</label>
								<div class="col-sm-5">
									<input type="text" name="phone" id="phone" placeholder="只能填写数字" class="form-control" />
								</div>
							</div>
                            <div class="hr-line-dashed"></div>

							<div class="form-group">
								<label class="col-sm-2 control-label"> 地址</label>
								<div class="col-sm-5">
									<input type="text" name="address" id="address" placeholder="请输入地址" class="form-control" />
								</div>
							</div>
							<div class="hr-line-dashed"></div>

							<div class="form-group">
								<label class="col-sm-2 control-label"> 备注</label>
								<div class="col-sm-5">
									<input type="text" name="note" id="note" placeholder="请输入备注信息" class="form-control" />
								</div>
							</div>
                            <div class="hr-line-dashed"></div>
							<div class="form-group">
								<label class="col-sm-2 control-label"> 状&nbsp;态</label>
								<div class="col-sm-5" style="padding-top:5px;">
                                    <input name="state" id="state" value="1" class="js-switch" type="checkbox" checked />
									<span class="lbl">&nbsp;&nbsp;默认开启</span>
								</div>
							</div>
				            <div class="hr-line-dashed"></div>
							<div class="form-group">
								<div class="col-sm-4 col-sm-offset-2">
									<button class="btn btn-primary" type="submit">保存信息</button>&nbsp;&nbsp;&nbsp;
									<a class="btn btn-danger" href="javascript:history.go(-1);">返回</a>
								</div>
							</div>
						</form>
					</div>
				</div>
			</div>
		</div>
		<include file="Public:footer" />
	<js file='__PUBLIC__/Admin/uploadify/jquery.uploadify.min.js' />
	<link rel="stylesheet" href="__PUBLIC__/Admin/uploadify/uploadify.css">
	</body>

</html>
<script type="text/javascript">
	$("#photo_file").uploadify({
		'swf': '__PUBLIC__/Admin/uploadify/uploadify.swf?t={$nowtime}',
		'uploader': '{:U("Upload/uploaduserimg")}',
		'cancelImg': '__PUBLIC__/Admin/uploadify/uploadify-cancel.png',
		'buttonText': '上传头像',
		'height': 35,
		'fileTypeExts': '*.gif;*.jpg;*.png',
		'queueSizeLimit': 1,
		'onUploadSuccess': function(file, data, response) {
			$("#data_photo").val(data);
			$("#upload_img").attr('src', '__ROOT__/Uploads' + data).show();
		}
	});

</script>
<!-- 下拉CSS样式 -->
<script>

    var config = {
        '.chosen-select': {},
    }
    for (var selector in config) {
        $(selector).chosen(config[selector]);
    }

</script>

<!-- IOS开关样式配置 -->
<script>
var elem = document.querySelector('.js-switch');
    var switchery = new Switchery(elem, {
        color: '#1AB394'
    });
var config = {
    '.chosen-select': {},
}
for (var selector in config) {
    $(selector).chosen(config[selector]);
}

</script>



	</body>
</html>
